#ifndef HANDLERGAME_H
#define HANDLERGAME_H

#include <QObject>
#include <QtSql>
    #include <vector>
    #include <iostream>
    #include <string>
 using namespace std;
#include "datamodel.h"
#include "datasubip.h"

class HandlerGame : public QObject
{
    Q_OBJECT
public:
    explicit HandlerGame(QObject *parent = 0);
    static bool initDB();
    static QList<DataModel *> getList();
    static DataModel * getGame(int id);
    static DataModel * reflashGame(DataModel *model);
    static bool addGame(DataModel *model);
    static bool updateGame(DataModel * model);
    static bool updateStatus(DataModel * model);
    static bool delGame(DataModel *model);
    static bool delGame(int id);
    static bool checkBuildConnect();
    static bool copyGameFile(DataModel *model,QString haveGameDir);
    static void trGameFile(DataModel *model);
    static int trGameFilePbr(int id);
    static bool openGameDisk(DataModel *model);
    static bool updateCheckHandleEnd(DataModel *model);
    static bool updateGameDown(DataModel *model);
    static int updateGameDownTimer(int id);
    static void updateGameInfo(DataModel *model);
    static void openGameDir(DataModel *model);

    static bool openRunGame(DataModel *model);
    static bool openRunGame(int id);
    static bool closeRunGame(int id);
    static bool clintRunGame(DataModel *model);
    static bool initComplete(DataModel *model);
    static int initSizeing(int id);
    static void initEnsure(DataModel *model);
    static void initCancel(DataModel *model);

    static QList<DataSubIp *> getIpsList();
    static void saveIp(QString ip,long port);
    static bool downGame(int id);
    static bool pauseGame(int id);


    static QString s2q(const string &s);
    static string q2s(const QString &s);

signals:

public slots:

private:


};

#endif // HANDLERGAME_H
